//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package init;

import mgr.ResourceManager;
import objects.AnimalEntry;
import objects.Animals;
import objects.ExpLevels;
import objects.ExpLevelsEntry;
import objects.ExtensionMaterialsEntry;
import objects.FactoryEntry;
import objects.Field;
import objects.FieldsEntry;
import objects.Forests;
import objects.FruitEntry;
import objects.FruitTreeEntry;
import objects.FruitTrees;
import objects.Fruits;
import objects.IEntryToSellOrBuy;
import objects.IGlobalIDName;
import objects.IUnlockLevel;
import objects.LogicEventData;
import objects.LogicEventDataEntry;
import objects.Mine;
import objects.MineGoodEntry;
import objects.MineToolEntry;
import objects.NectarTreeEntry;
import objects.NectarTrees;
import objects.Peoples;
import objects.PeoplesEntry;
import objects.ProcessingBuildings;
import objects.Productions;
import objects.Productions.Entry;
import objects.ProductionsGoodEntry;
import objects.Silos;
import objects.SilosBarnMaterials;
import objects.Tools;
import objects.ToolsEntry;
import objects.Tutorials;
import objects.WareHouse;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;

public class StaticData {
	private static ResourceManager csvManager = new ResourceManager();

	public StaticData() {
	}

	public static void initResources() throws IOException, Exception {
		initEvents();
		initMineTools();
		initMineGoods();
		initFields();
		initPeoples();
		initExpLevels();
		initBarn();
		initSilos();
		initTools();
		initMaterials();
		initProcessingBuildings();
		initAnimals();
		initAnimalsProduction();
		initForests();
		initFruits();
		initFruitTrees();
		Iterator var1 = FruitTrees.get().iterator();

		while (var1.hasNext()) {
			FruitTreeEntry e = (FruitTreeEntry) var1.next();
			FruitEntry npge = Fruits.getByTree(e.getName());
			ProductionsGoodEntry npge1 = new ProductionsGoodEntry(npge.getName(), e.getTimeMin(0), npge.getDefaultPrice(), e.getName(), npge.getUnlockLevel(), npge.getDiamondPrice(), npge.getExpCollect());
			e.addGoodEntryWithObjectClass(npge1, 61, e.getInstance().intValue());
		}

		initNectarTrees();
		var1 = NectarTrees.get().iterator();

		while (var1.hasNext()) {
			NectarTreeEntry e1 = (NectarTreeEntry) var1.next();
			ProductionsGoodEntry npge2 = new ProductionsGoodEntry("Nectar", Integer.valueOf(0), Integer.valueOf(0), e1.getName(), Integer.valueOf(39), Integer.valueOf(1000000), Integer.valueOf(0));
			e1.addGoodEntryWithObjectClass(npge2, 148, e1.getInstance().intValue());
		}

		initTutorials();
		Productions.addEntry(new Entry(Integer.valueOf(24), "bakery_goods.csv", "Bakery"));
		Productions.addEntry(new Entry(Integer.valueOf(16), "animal_feed.csv", "Hammermill"));
		Productions.addEntry(new Entry(Integer.valueOf(29), "popcorn_pot_goods.csv", "Popcorn_Pot"));
		Productions.addEntry(new Entry(Integer.valueOf(23), "dairy_goods.csv", "Dairy"));
		Productions.addEntry(new Entry(Integer.valueOf(27), "sugar_mill_goods.csv", "Sugar_Mill"));
		Productions.addEntry(new Entry(Integer.valueOf(26), "pie_oven_goods.csv", "Pie_Oven"));
		Productions.addEntry(new Entry(Integer.valueOf(28), "loom_goods.csv", "Loom"));
		Productions.addEntry(new Entry(Integer.valueOf(25), "cake_oven_goods.csv", "Cake_Oven"));
		Productions.addEntry(new Entry(Integer.valueOf(30), "barbecue_grill_goods.csv", "Barbecue_Grill"));
		Productions.addEntry(new Entry(Integer.valueOf(60), "juice_press_goods.csv", "Juice_Press"));
		Productions.addEntry(new Entry(Integer.valueOf(66), "jam_maker_goods.csv", "Jam_Maker"));
		Productions.addEntry(new Entry(Integer.valueOf(65), "smelter_goods.csv", "Smelter"));
		Productions.addEntry(new Entry(Integer.valueOf(69), "ice_cream_maker_goods.csv", "Ice_Cream_Maker"));
		Productions.addEntry(new Entry(Integer.valueOf(75), "jeweler_goods.csv", "Jeweler"));
		Productions.addEntry(new Entry(Integer.valueOf(82), "cafe_goods.csv", "Cafe_Kiosk"));
		Productions.addEntry(new Entry(Integer.valueOf(84), "candy_machine_goods.csv", "Candy_Machine"));
		Productions.addEntry(new Entry(Integer.valueOf(109), "soup_kitchen_goods.csv", "Soup_Kitchen"));
		Productions.addEntry(new Entry(Integer.valueOf(119), "sauce_mixer_goods.csv", "Sauce_Mixer"));
		Productions.addEntry(new Entry(Integer.valueOf(117), "sushi_bar_goods.csv", "Sushi_Bar"));
		Productions.addEntry(new Entry(Integer.valueOf(118), "salad_bar_goods.csv", "Salad_Bar"));
		Productions.addEntry(new Entry(Integer.valueOf(121), "sandwich_bar_goods.csv", "Sandwich_Bar"));
		Productions.addEntry(new Entry(Integer.valueOf(129), "smoothie_mixer_goods.csv", "Smoothie_Mixer"));
		Productions.addEntry(new Entry(Integer.valueOf(145), "sewing_machine_goods.csv", "Sewing_Machine"));
		Productions.addEntry(new Entry(Integer.valueOf(152), "honey_extractor_goods.csv", "Honey_Extractor"));
		Productions.addEntry(new Entry(Integer.valueOf(153), "candle_maker_goods.csv", "Candle_Maker"));
		Productions.addEntry(new Entry(Integer.valueOf(166), "hat_maker_goods.csv", "Hat_Maker"));
		Productions.addEntry(new Entry(Integer.valueOf(168), "pasta_maker_goods.csv", "Pasta_Maker"));
		Productions.addEntry(new Entry(Integer.valueOf(167), "hotdog_stand_goods.csv", "Hotdog_Stand"));
		Productions.addEntry(new Entry(Integer.valueOf(169), "pasta_kitchen_goods.csv", "Pasta_Kitchen"));
		var1 = Productions.getProductionList().iterator();

		while (var1.hasNext()) {
			Entry e2 = (Entry) var1.next();
			initProductionFactories(e2.getProductionName(), e2.getCsvFile(), e2.getObjectClass().intValue());
		}

	}

	private static void initFields() throws IOException, Exception {
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", "fields.csv", header, entries);
		Iterator var3 = entries.iterator();

		while (var3.hasNext()) {
			List entry = (List) var3.next();
			String Name = (String) entry.get(((Integer) header.get("Name")).intValue());
			if (Name != null && Name.length() > 0) {
				Integer UnlockLevel = Integer.valueOf(0);
				Integer DumbValue = Integer.valueOf(0);
				Integer TimeMin = Integer.valueOf(0);
				Integer TimeSec = Integer.valueOf(0);
				Integer DiamondPrice = Integer.valueOf(1000000);
				Integer InstanceId = Integer.valueOf(Field.getNextInstanceId());
				Integer ExpCollect = Integer.valueOf(0);
				String ul = (String) entry.get(((Integer) header.get("UnlockLevel")).intValue());
				String dv = (String) entry.get(((Integer) header.get("DumbValue")).intValue());
				String tm = (String) entry.get(((Integer) header.get("TimeMin")).intValue());
				String ts = (String) entry.get(((Integer) header.get("TimeSec")).intValue());
				String dp = (String) entry.get(((Integer) header.get("DiamondPrice")).intValue());
				String ec = (String) entry.get(((Integer) header.get("ExpCollect")).intValue());
				if (ul != null && ul.length() > 0) {
					UnlockLevel = Integer.valueOf(ul);
				}

				if (dv != null && dv.length() > 0) {
					DumbValue = Integer.valueOf(dv);
				}

				if (tm != null && tm.length() > 0) {
					TimeMin = Integer.valueOf(tm);
				}

				if (ts != null && ts.length() > 0) {
					TimeSec = Integer.valueOf(ts);
				}

				if (dp != null && dp.length() > 0) {
					DiamondPrice = Integer.valueOf(dp);
				}

				if (ec != null && ec.length() > 0) {
					ExpCollect = Integer.valueOf(ec);
				}

				Field.addFieldEntry(new FieldsEntry(Name, UnlockLevel, DumbValue, TimeMin, TimeSec, InstanceId, DiamondPrice, ExpCollect));
			}
		}

	}

	private static void initSilos() throws IOException, Exception {
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", "silos.csv", header, entries);
		String tool1 = null;
		String tool2 = null;
		String tool3 = null;
		LinkedHashMap sl = new LinkedHashMap();
		int level = 0;

		for (Iterator var8 = entries.iterator(); var8.hasNext(); ++level) {
			List entry = (List) var8.next();
			String Name = (String) entry.get(((Integer) header.get("Name")).intValue());
			String c;
			if (Name != null && Name.length() > 0) {
				c = (String) entry.get(((Integer) header.get("CollectionTool1")).intValue());
				if (c != null && c.length() > 0) {
					tool1 = c;
				}

				c = (String) entry.get(((Integer) header.get("CollectionTool2")).intValue());
				if (c != null && c.length() > 0) {
					tool2 = c;
				}

				c = (String) entry.get(((Integer) header.get("CollectionTool3")).intValue());
				if (c != null && c.length() > 0) {
					tool3 = c;
				}
			}

			c = (String) entry.get(((Integer) header.get("Capacity")).intValue());
			if (c != null && c.length() > 0) {
				sl.put(Integer.valueOf(level), Integer.valueOf(c));
			}
		}

		Silos.set(sl, tool1, tool2, tool3);
	}

	private static void initExpLevels() throws IOException, Exception {
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", "exp_levels.csv", header, entries);
		ExpLevelsEntry lastEntry = null;
		Iterator var4 = entries.iterator();

		while (true) {
			while (var4.hasNext()) {
				List entry = (List) var4.next();
				String level = (String) entry.get(((Integer) header.get("Level")).intValue());
				String good = (String) entry.get(((Integer) header.get("GoodReward")).intValue());
				String amount = (String) entry.get(((Integer) header.get("GoodAmount")).intValue());
				if (level != null && level.length() > 0) {
					Integer Level = Integer.valueOf(level);
					Integer ExpToNextLevel = Integer.valueOf((String) entry.get(((Integer) header.get("ExpToNextLevel")).intValue()));
					Integer MaxFields = Integer.valueOf((String) entry.get(((Integer) header.get("MaxFields")).intValue()));
					ExpLevelsEntry e = new ExpLevelsEntry(Level, ExpToNextLevel, MaxFields);
					if (good != null && good.length() > 0 && amount != null && amount.length() > 0) {
						e.addReward(good, Integer.valueOf(amount));
					}

					ExpLevels.add(e);
					lastEntry = e;
				} else if (lastEntry != null && good != null && good.length() > 0 && amount != null && amount.length() > 0) {
					lastEntry.addReward(good, Integer.valueOf(amount));
				}
			}

			return;
		}
	}

	private static void initBarn() throws IOException, Exception {
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", "warehouses.csv", header, entries);
		String tool1 = null;
		String tool2 = null;
		String tool3 = null;
		LinkedHashMap sl = new LinkedHashMap();
		int level = 0;

		for (Iterator var8 = entries.iterator(); var8.hasNext(); ++level) {
			List entry = (List) var8.next();
			String Name = (String) entry.get(((Integer) header.get("Name")).intValue());
			String c;
			if (Name != null && Name.length() > 0) {
				c = (String) entry.get(((Integer) header.get("CollectionTool1")).intValue());
				if (c != null && c.length() > 0) {
					tool1 = c;
				}

				c = (String) entry.get(((Integer) header.get("CollectionTool2")).intValue());
				if (c != null && c.length() > 0) {
					tool2 = c;
				}

				c = (String) entry.get(((Integer) header.get("CollectionTool3")).intValue());
				if (c != null && c.length() > 0) {
					tool3 = c;
				}
			}

			c = (String) entry.get(((Integer) header.get("Capacity")).intValue());
			if (c != null && c.length() > 0) {
				sl.put(Integer.valueOf(level), Integer.valueOf(c));
			}
		}

		WareHouse.set(sl, tool1, tool2, tool3);
	}

	private static void initPeoples() throws IOException, Exception {
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", "people.csv", header, entries);
		Iterator var3 = entries.iterator();

		while (var3.hasNext()) {
			List entry = (List) var3.next();
			String Name = (String) entry.get(((Integer) header.get("Name")).intValue());
			if (Name != null && Name.length() > 0) {
				Integer WalkSpeed = Integer.valueOf((String) entry.get(((Integer) header.get("WalkSpeed")).intValue()));
				Integer IdleTime = Integer.valueOf((String) entry.get(((Integer) header.get("IdleTime")).intValue()));
				Integer UnlockLevel = Integer.valueOf((String) entry.get(((Integer) header.get("UnlockLevel")).intValue()));
				Peoples.add(new PeoplesEntry(Name, WalkSpeed, IdleTime, UnlockLevel));
			}
		}

	}

	private static void initMaterials() throws IOException, Exception {
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", "collection_tools.csv", header, entries);

		String Name;
		Integer UnlockLevel;
		Integer DumbValue;
		Integer DiamondPrice;
		Integer ReputationUnlockLevel;
		for (Iterator var3 = entries.iterator(); var3.hasNext(); SilosBarnMaterials.addEntry(new ExtensionMaterialsEntry(Name, UnlockLevel, DumbValue, DiamondPrice, ReputationUnlockLevel))) {
			List entry = (List) var3.next();
			Name = (String) entry.get(((Integer) header.get("Name")).intValue());
			UnlockLevel = Integer.valueOf((String) entry.get(((Integer) header.get("UnlockLevel")).intValue()));
			DumbValue = Integer.valueOf((String) entry.get(((Integer) header.get("DumbValue")).intValue()));
			DiamondPrice = Integer.valueOf((String) entry.get(((Integer) header.get("DiamondPrice")).intValue()));
			ReputationUnlockLevel = Integer.valueOf(0);
			String rul = (String) entry.get(((Integer) header.get("ReputationUnlockLevel")).intValue());
			if (rul != null && rul.length() > 0) {
				ReputationUnlockLevel = Integer.valueOf(rul);
			}
		}

	}

	private static void initTools() throws IOException, Exception {
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", "tools.csv", header, entries);
		Iterator var3 = entries.iterator();

		while (var3.hasNext()) {
			List entry = (List) var3.next();
			String Name = (String) entry.get(((Integer) header.get("Name")).intValue());
			Integer UnlockLevel = Integer.valueOf((String) entry.get(((Integer) header.get("UnlockLevel")).intValue()));
			Integer DumbValue = Integer.valueOf((String) entry.get(((Integer) header.get("DumbValue")).intValue()));
			Integer DiamondPrice = Integer.valueOf((String) entry.get(((Integer) header.get("DiamondPrice")).intValue()));
			Tools.add(new ToolsEntry(Name, UnlockLevel, DumbValue, DiamondPrice));
		}

	}

	private static void initFruits() throws IOException, Exception {
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", "fruits.csv", header, entries);
		Iterator var3 = entries.iterator();

		while (var3.hasNext()) {
			List entry = (List) var3.next();
			String name = (String) entry.get(((Integer) header.get("Name")).intValue());
			if (name != null && name.length() > 0) {
				Integer unlockLevel = Integer.valueOf((String) entry.get(((Integer) header.get("UnlockLevel")).intValue()));
				String tree = (String) entry.get(((Integer) header.get("ProcessingBuilding")).intValue());
				Integer defPrice = Integer.valueOf((String) entry.get(((Integer) header.get("DumbValue")).intValue()));
				Integer diamodPrice = Integer.valueOf((String) entry.get(((Integer) header.get("OrderValue")).intValue()));
				Integer ExpCollect = Integer.valueOf((String) entry.get(((Integer) header.get("ExpCollect")).intValue()));
				Fruits.createFruitEntry(name, unlockLevel, tree, defPrice, diamodPrice, ExpCollect);
			}
		}

	}

	private static void initAnimals() throws IOException, Exception {
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", "animals.csv", header, entries);
		Iterator var3 = entries.iterator();

		while (var3.hasNext()) {
			List entry = (List) var3.next();
			String name = (String) entry.get(((Integer) header.get("Name")).intValue());
			if (name != null && name.length() > 0) {
				Integer unlockLevel = Integer.valueOf((String) entry.get(((Integer) header.get("UnlockLevel")).intValue()));
				String feed = (String) entry.get(((Integer) header.get("Feed")).intValue());
				String good = (String) entry.get(((Integer) header.get("Good")).intValue());
				Animals.createAnimalEntry(name, unlockLevel, feed, good);
			}
		}

	}

	private static void initProcessingBuildings() throws IOException, Exception {
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", "processing_buildings.csv", header, entries);
		Iterator var3 = entries.iterator();

		while (var3.hasNext()) {
			List entry = (List) var3.next();
			String Name = (String) entry.get(((Integer) header.get("Name")).intValue());
			if (Name != null && Name.length() > 0) {
				Integer unlockLevel = Integer.valueOf((String) entry.get(((Integer) header.get("UnlockLevel")).intValue()));
				Integer slots = Integer.valueOf((String) entry.get(((Integer) header.get("Slots")).intValue()));
				Integer timemin = Integer.valueOf(0);
				Integer timesec = Integer.valueOf(0);
				Integer exptobuild = Integer.valueOf(0);
				String tm = (String) entry.get(((Integer) header.get("TimeMin")).intValue());
				if (tm != null && tm.length() > 0) {
					timemin = Integer.valueOf(tm);
				}

				String ts = (String) entry.get(((Integer) header.get("TimeSec")).intValue());
				if (ts != null && ts.length() > 0) {
					timesec = Integer.valueOf(ts);
				}

				String etb = (String) entry.get(((Integer) header.get("ExpToBuild")).intValue());
				if (etb != null && etb.length() > 0) {
					exptobuild = Integer.valueOf(etb);
				}

				ProcessingBuildings.addFactory(Name, slots.intValue(), unlockLevel.intValue(), timemin.intValue(), timesec.intValue(), exptobuild.intValue());
			}
		}

	}

	private static void initNectarTrees() throws IOException, Exception {
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", "gatherer_mines.csv", header, entries);
		Iterator var3 = entries.iterator();

		while (var3.hasNext()) {
			List entry = (List) var3.next();
			String name = (String) entry.get(((Integer) header.get("Name")).intValue());
			if (name != null && name.length() > 0) {
				String tool = (String) entry.get(((Integer) header.get("Tool")).intValue());
				Integer price = Integer.valueOf((String) entry.get(((Integer) header.get("Price")).intValue()));
				Integer time = Integer.valueOf((String) entry.get(((Integer) header.get("TimeMin")).intValue()));
				Integer fruitCount = Integer.valueOf((String) entry.get(((Integer) header.get("FruitCount")).intValue()));
				NectarTrees.createNectarTreeEntry(name, time, fruitCount, tool, price);
			}
		}

	}

	private static void initFruitTrees() throws IOException, Exception {
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", "fruit_trees.csv", header, entries);
		String lastTreeName = null;
		Iterator var4 = entries.iterator();

		while (true) {
			while (var4.hasNext()) {
				List entry = (List) var4.next();
				String name = (String) entry.get(((Integer) header.get("Name")).intValue());
				Integer fruitCount;
				if (name != null && name.length() > 0) {
					String time2 = (String) entry.get(((Integer) header.get("Tool")).intValue());
					fruitCount = Integer.valueOf((String) entry.get(((Integer) header.get("Price")).intValue()));
					Integer time1 = Integer.valueOf((String) entry.get(((Integer) header.get("TimeMin")).intValue()));
					Integer fruitCount1 = Integer.valueOf((String) entry.get(((Integer) header.get("FruitCount")).intValue()));
					FruitTrees.createFruitTreeEntry(name, time2, fruitCount);
					FruitTrees.treeAddStage(name, time1, fruitCount1);
					lastTreeName = name;
				} else if (lastTreeName != null && lastTreeName.length() > 0) {
					Integer time = Integer.valueOf((String) entry.get(((Integer) header.get("TimeMin")).intValue()));
					fruitCount = Integer.valueOf((String) entry.get(((Integer) header.get("FruitCount")).intValue()));
					FruitTrees.treeAddStage(lastTreeName, time, fruitCount);
				}
			}

			return;
		}
	}

	private static void initForests() throws IOException, Exception {
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", "forests.csv", header, entries);
		Iterator var3 = entries.iterator();

		while (var3.hasNext()) {
			List entry = (List) var3.next();
			String name = (String) entry.get(((Integer) header.get("Name")).intValue());
			if (name != null && name.length() > 0) {
				String tool = (String) entry.get(((Integer) header.get("Tool")).intValue());
				Integer ExpClear = Integer.valueOf((String) entry.get(((Integer) header.get("ExpClear")).intValue()));
				Integer TileWidth = Integer.valueOf((String) entry.get(((Integer) header.get("TileWidth")).intValue()));
				Integer TileHeight = Integer.valueOf((String) entry.get(((Integer) header.get("TileHeight")).intValue()));
				Forests.createForestsEntry(name, tool, ExpClear, TileWidth, TileHeight);
			}
		}

	}

	private static void initTutorials() throws IOException, Exception {
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", "tutorials.csv", header, entries);
		Iterator var3 = entries.iterator();

		while (var3.hasNext()) {
			List entry = (List) var3.next();
			String name = (String) entry.get(((Integer) header.get("Name")).intValue());
			if (name != null && name.length() > 0) {
				String maxlvl = (String) entry.get(((Integer) header.get("MaxExpLevel10")).intValue());
				String minlvl = (String) entry.get(((Integer) header.get("MinExpLevel10")).intValue());
				Integer max = Integer.valueOf(0);
				Integer min = Integer.valueOf(0);
				if (maxlvl != null && maxlvl.length() > 0) {
					max = Integer.valueOf(maxlvl);
				}

				if (minlvl != null && minlvl.length() > 0) {
					min = Integer.valueOf(minlvl);
				}

				Tutorials.createEntry(name, max, min);
			}
		}

	}

	private static void initProductionFactories(String name, String goodsSource, int oClass) throws IOException, Exception {
		FactoryEntry fe = ProcessingBuildings.getByName(name);
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", goodsSource, header, entries);

		ProductionsGoodEntry npge;
		for (Iterator var7 = entries.iterator(); var7.hasNext(); fe.addGoodEntryWithObjectClass(npge, oClass)) {
			List entry = (List) var7.next();
			npge = null;
			String Requirement = null;
			Integer RequirementAmount = null;
			Integer ridx = (Integer) header.get("Requirement");
			if (ridx != null) {
				Requirement = (String) entry.get(ridx.intValue());
			}

			Integer raidx = (Integer) header.get("RequirementAmount");
			if (raidx != null) {
				RequirementAmount = Integer.valueOf((String) entry.get(raidx.intValue()));
			}

			String Name = (String) entry.get(((Integer) header.get("Name")).intValue());
			if (Name != null && Name.length() > 0) {
				Integer TimeMin = Integer.valueOf(0);
				Integer tmIdx = (Integer) header.get("TimeMin");
				if (tmIdx != null) {
					TimeMin = Integer.valueOf((String) entry.get(tmIdx.intValue()));
				}

				Integer DumbValue = Integer.valueOf((String) entry.get(((Integer) header.get("DumbValue")).intValue()));
				Integer pbIndex = (Integer) header.get("ProcessingBuilding");
				String ProcessingBuilding;
				if (pbIndex != null) {
					ProcessingBuilding = (String) entry.get(pbIndex.intValue());
				} else {
					ProcessingBuilding = name;
				}

				Integer UnlockLevel = null;
				Integer index = (Integer) header.get("UnlockLevel");
				if (index != null) {
					UnlockLevel = Integer.valueOf((String) entry.get(index.intValue()));
				}

				Integer DiamondPrice = Integer.valueOf(1000000);
				Integer dIndex = (Integer) header.get("OrderValue");
				if (dIndex != null) {
					DiamondPrice = Integer.valueOf((String) entry.get(dIndex.intValue()));
				} else {
					dIndex = (Integer) header.get("DiamondPrice");
					if (dIndex != null) {
						DiamondPrice = Integer.valueOf((String) entry.get(dIndex.intValue()));
					}
				}

				Integer ExpCollect = Integer.valueOf(0);
				Integer ecIndex = (Integer) header.get("ExpCollect");
				if (ecIndex != null) {
					ExpCollect = Integer.valueOf((String) entry.get(ecIndex.intValue()));
				}

				npge = new ProductionsGoodEntry(Name, TimeMin, DumbValue, ProcessingBuilding, UnlockLevel, DiamondPrice, ExpCollect);
			} else {
				npge = new ProductionsGoodEntry((String) null, (Integer) null, (Integer) null, (String) null, (Integer) null, (Integer) null, (Integer) null);
			}

			if (Requirement != null) {
				npge.addRequirement(Requirement, RequirementAmount);
			}
		}

	}

	private static void initAnimalsProduction() throws IOException, Exception {
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", "animal_goods.csv", header, entries);
		Iterator var3 = entries.iterator();

		while (var3.hasNext()) {
			List entry = (List) var3.next();
			String Name = (String) entry.get(((Integer) header.get("Name")).intValue());
			if (Name != null && Name.length() > 0) {
				AnimalEntry ae = Animals.getByGood(Name);
				if (ae != null) {
					Integer UnlockLevel = Integer.valueOf((String) entry.get(((Integer) header.get("UnlockLevel")).intValue()));
					Integer TimeMin = Integer.valueOf((String) entry.get(((Integer) header.get("TimeMin")).intValue()));
					Integer DumbValue = Integer.valueOf((String) entry.get(((Integer) header.get("DumbValue")).intValue()));
					Integer DiamondPrice = Integer.valueOf(1000000);
					Integer dIndex = (Integer) header.get("OrderValue");
					if (dIndex != null) {
						DiamondPrice = Integer.valueOf((String) entry.get(dIndex.intValue()));
					} else {
						dIndex = (Integer) header.get("DiamondPrice");
						if (dIndex != null) {
							DiamondPrice = Integer.valueOf((String) entry.get(dIndex.intValue()));
						}
					}

					String ProcessingBuilding = ae.getName();
					Integer ExpCollect = Integer.valueOf(0);
					Integer ecIndex = (Integer) header.get("ExpCollect");
					if (ecIndex != null) {
						ExpCollect = Integer.valueOf((String) entry.get(ecIndex.intValue()));
					}

					ProductionsGoodEntry npge = new ProductionsGoodEntry(Name, TimeMin, DumbValue, ProcessingBuilding, UnlockLevel, DiamondPrice, ExpCollect);
					npge.addRequirement(ae.getFeed(), Integer.valueOf(1));
					ae.addGoodEntryWithObjectClass(npge, 15, ae.getInstance().intValue());
				}
			}
		}

	}

	private static void initMineTools() throws IOException, Exception {
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", "mines.csv", header, entries);
		boolean getetb = true;
		Iterator var4 = entries.iterator();

		while (var4.hasNext()) {
			List entry = (List) var4.next();
			String Name = (String) entry.get(((Integer) header.get("Name")).intValue());
			if (!Name.equals("Mine")) {
				if (getetb) {
					Integer Tool = Integer.valueOf((String) entry.get(((Integer) header.get("ExpToBuild")).intValue()));
					Mine.setExpToBuild(Tool);
					getetb = false;
				}

				String Tool1 = (String) entry.get(((Integer) header.get("Tool")).intValue());
				Integer NumOres = Integer.valueOf((String) entry.get(((Integer) header.get("NumOres")).intValue()));
				Integer DiamondChance = Integer.valueOf((String) entry.get(((Integer) header.get("DiamondChance")).intValue()));
				Mine.addTool(new MineToolEntry(Tool1, NumOres, DiamondChance));
			}
		}

	}

	private static void initMineGoods() throws IOException, Exception {
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", "mine_goods.csv", header, entries);
		Iterator var3 = entries.iterator();

		while (var3.hasNext()) {
			List entry = (List) var3.next();
			String Name = (String) entry.get(((Integer) header.get("Name")).intValue());
			Integer ExpCollect = Integer.valueOf((String) entry.get(((Integer) header.get("ExpCollect")).intValue()));
			Integer UnlockLevel = Integer.valueOf((String) entry.get(((Integer) header.get("UnlockLevel")).intValue()));
			Integer DumbValue = Integer.valueOf((String) entry.get(((Integer) header.get("DumbValue")).intValue()));
			Integer Probability = Integer.valueOf((String) entry.get(((Integer) header.get("Probability")).intValue()));
			Integer DiamondPrice = Integer.valueOf((String) entry.get(((Integer) header.get("DiamondPrice")).intValue()));
			Mine.addGood(new MineGoodEntry(Name, ExpCollect, UnlockLevel, DumbValue, Probability, DiamondPrice));
		}

	}

	private static void initEvents() throws IOException, Exception {
		LinkedHashMap header = new LinkedHashMap();
		ArrayList entries = new ArrayList();
		csvManager.getConfig("hayday", "events.csv", header, entries);
		Iterator var3 = entries.iterator();

		while (true) {
			List entry;
			String event;
			do {
				do {
					if (!var3.hasNext()) {
						return;
					}

					entry = (List) var3.next();
					event = (String) entry.get(((Integer) header.get("Event")).intValue());
				} while (event == null);
			} while (event.length() <= 0);

			String GoodReward = (String) entry.get(((Integer) header.get("GoodReward")).intValue());
			int idx = ((Integer) header.get("GoodAmount")).intValue();
			Integer GoodAmount = Integer.valueOf((String) entry.get(idx++));
			ArrayList l = new ArrayList();

			for (int lede = idx; lede < entry.size(); ++lede) {
				String gVal = (String) entry.get(lede);
				if (gVal != null && gVal.length() > 0) {
					l.add(Integer.valueOf(gVal));
				}
			}

			LogicEventDataEntry var11 = new LogicEventDataEntry(event, GoodReward, GoodAmount);
			var11.initGroup(l);
			LogicEventData.addEvent(var11);
		}
	}

	public static String getGlobalName(Integer id) {
		String name = getGlobalNameExactly(id);
		return name == null ? id.toString() : name;
	}

	private static IEntryToSellOrBuy getEntryById(Integer id) {
		FieldsEntry fe = Field.getEntryById(id.intValue());
		if (fe != null) {
			return fe;
		} else {
			ExtensionMaterialsEntry eme = SilosBarnMaterials.getById(id);
			if (eme != null) {
				return eme;
			} else {
				ToolsEntry te = Tools.getById(id.intValue());
				if (te != null) {
					return te;
				} else {
					MineGoodEntry mge = Mine.getGoodById(id);
					if (mge != null) {
						return mge;
					} else {
						Iterator var6 = Animals.get().iterator();

						ProductionsGoodEntry pge;
						while (var6.hasNext()) {
							AnimalEntry f = (AnimalEntry) var6.next();
							pge = f.getGoodById(id);
							if (pge != null) {
								return pge;
							}
						}

						var6 = FruitTrees.get().iterator();

						while (var6.hasNext()) {
							FruitTreeEntry f1 = (FruitTreeEntry) var6.next();
							pge = f1.getGoodById(id);
							if (pge != null) {
								return pge;
							}
						}

						var6 = ProcessingBuildings.getFactories().iterator();

						while (var6.hasNext()) {
							FactoryEntry f2 = (FactoryEntry) var6.next();
							pge = f2.getGoodById(id);
							if (pge != null) {
								return pge;
							}
						}

						return null;
					}
				}
			}
		}
	}

	public static IGlobalIDName getGlobalById(Integer id) {
		FieldsEntry fe = Field.getEntryById(id.intValue());
		if (fe != null) {
			return fe;
		} else {
			ExtensionMaterialsEntry eme = SilosBarnMaterials.getById(id);
			if (eme != null) {
				return eme;
			} else {
				ToolsEntry te = Tools.getById(id.intValue());
				if (te != null) {
					return te;
				} else {
					MineGoodEntry mge = Mine.getGoodById(id);
					if (mge != null) {
						return mge;
					} else {
						PeoplesEntry pe = Peoples.getById(id);
						if (pe != null) {
							return pe;
						} else {
							Iterator var7 = Animals.get().iterator();

							ProductionsGoodEntry pge;
							while (var7.hasNext()) {
								AnimalEntry f = (AnimalEntry) var7.next();
								pge = f.getGoodById(id);
								if (pge != null) {
									return pge;
								}
							}

							var7 = FruitTrees.get().iterator();

							while (var7.hasNext()) {
								FruitTreeEntry f1 = (FruitTreeEntry) var7.next();
								pge = f1.getGoodById(id);
								if (pge != null) {
									return pge;
								}
							}

							var7 = ProcessingBuildings.getFactories().iterator();

							while (var7.hasNext()) {
								FactoryEntry f2 = (FactoryEntry) var7.next();
								pge = f2.getGoodById(id);
								if (pge != null) {
									return pge;
								}
							}

							return null;
						}
					}
				}
			}
		}
	}

	public static String getGlobalNameExactly(Integer id) {
		IGlobalIDName g = getGlobalById(id);
		return g != null ? g.getName() : null;
	}

	public static Integer getGlobalId(String name) {
		Integer val = Field.getIdByName(name);
		if (val != null) {
			return val;
		} else {
			val = SilosBarnMaterials.getGlobalID(name);
			if (val != null) {
				return val;
			} else {
				ToolsEntry te = Tools.getByName(name);
				if (te != null) {
					return te.getGlobalID();
				} else {
					MineGoodEntry mge = Mine.getGoodByName(name);
					if (mge != null) {
						return mge.getGlobalID();
					} else {
						PeoplesEntry pe = Peoples.getByName(name);
						if (pe != null) {
							return Integer.valueOf(pe.getGlobalID());
						} else {
							Iterator var6 = Animals.get().iterator();

							ProductionsGoodEntry pge;
							while (var6.hasNext()) {
								AnimalEntry fe = (AnimalEntry) var6.next();
								pge = fe.getGoodByName(name);
								if (pge != null) {
									return pge.getGlobalID(Integer.valueOf(15));
								}
							}

							var6 = FruitTrees.get().iterator();

							while (var6.hasNext()) {
								FruitTreeEntry fe1 = (FruitTreeEntry) var6.next();
								pge = fe1.getGoodByName(name);
								if (pge != null) {
									return pge.getGlobalID(Integer.valueOf(61));
								}
							}

							var6 = ProcessingBuildings.getFactories().iterator();

							while (var6.hasNext()) {
								FactoryEntry fe2 = (FactoryEntry) var6.next();
								pge = fe2.getGoodByName(name);
								if (pge != null) {
									Entry e = Productions.get(fe2.getName());
									if (e != null) {
										return pge.getGlobalID(e.getObjectClass());
									}
								}
							}

							return null;
						}
					}
				}
			}
		}
	}

	public static IUnlockLevel getULById(Integer id) {
		FieldsEntry fe = Field.getEntryById(id.intValue());
		if (fe != null) {
			return fe;
		} else {
			ExtensionMaterialsEntry eme = SilosBarnMaterials.getById(id);
			if (eme != null) {
				return eme;
			} else {
				ToolsEntry te = Tools.getById(id.intValue());
				if (te != null) {
					return te;
				} else {
					MineGoodEntry mge = Mine.getGoodById(id);
					if (mge != null) {
						return mge;
					} else {
						PeoplesEntry pe = Peoples.getById(id);
						if (pe != null) {
							return pe;
						} else {
							Iterator var7 = Animals.get().iterator();

							ProductionsGoodEntry pge;
							while (var7.hasNext()) {
								AnimalEntry f = (AnimalEntry) var7.next();
								pge = f.getGoodById(id);
								if (pge != null) {
									return pge;
								}
							}

							var7 = FruitTrees.get().iterator();

							while (var7.hasNext()) {
								FruitTreeEntry f1 = (FruitTreeEntry) var7.next();
								pge = f1.getGoodById(id);
								if (pge != null) {
									return pge;
								}
							}

							var7 = ProcessingBuildings.getFactories().iterator();

							while (var7.hasNext()) {
								FactoryEntry f2 = (FactoryEntry) var7.next();
								pge = f2.getGoodById(id);
								if (pge != null) {
									return pge;
								}
							}

							return null;
						}
					}
				}
			}
		}
	}

	public static int getUnlockLevelById(Integer id) {
		IUnlockLevel u = getULById(id);
		return u != null ? u.getUnlockLevel().intValue() : 10000;
	}

	public static Integer getDiamondPriceById(Integer id) {
		IEntryToSellOrBuy e = getEntryById(id);
		return e != null ? e.getDiamondPrice() : null;
	}

	public static Integer getPriceById(Integer id) {
		IEntryToSellOrBuy e = getEntryById(id);
		return e != null ? e.getDefaultPrice() : null;
	}
}
